// first arg may be first factor's length
// second arg may be codes length

#include "binadd.h"

int main(int argc, char *argv[]){

	t_len	n=28,
				k=14, // code params
				n1=7;	// factor lenth					
	
	if (argc>=2) {
		t_len n1_= atoi(argv[1]) ; 
		n1 = ( n1_  ) ? n1_ : n1 ;
	}
	if (argc>=3) {
		t_len n_ = atoi (argv[2]) ;
		n = ( n_ ) ? n_ : n ;
	}

	if ( n%n1 ) {
		cerr << "Wrong factor's length: " << n1 ;
		exit(1) ;
	}

	t_len n2 = (t_len) n/n1 ;
	
	CBinCode C(k, n) ;	
	cin >> C ;
	C.convert() ;

	CBinWord tmp1(n1), tmp2(n2), r1(n), r2(n) ;
	// cout << C ;
	for ( int i=1; i < (1 << n1); i++ )	{
		for ( int j=1; j < (1 << n2); j++ )	{
			tmp1.num = i ;
			tmp2.num = j ;
			r1 = tmp1^tmp2 ;
			// r2 = tmp2^tmp1 ;
			if ( ! (C*r1).num ) {
				cout << r1 << endl;
				cerr << " = " << tmp1 << " ^ " << tmp2 << endl;
			}
			/*
			if ( ! (C*r2).num ) {
				cout << r2 << endl;
				cerr << " = " << tmp2 << " ^ " << tmp1 << endl;
			}
			*/
		}
	}
	// cout << '*' ;
	return 0 ;
}
